//
//  LTNetworkTools.swift
//  微博08
//
//  Created by 123 on 16/3/2.
//  Copyright © 2016年 Tsr. All rights reserved.
//

import UIKit
import AFNetworking

class LTNetworkTools: NSObject {
    let afnManager: AFHTTPSessionManager
    
    // 单例
    static let sharedInstance: LTNetworkTools = LTNetworkTools()
    
    // private表示私有方法,除这个文件外的其它类是不知道这个方法的
    private override init() {
        let baseURL = NSURL(string: "https://api.weibo.com/")
        afnManager = AFHTTPSessionManager(baseURL: baseURL)
        
        super.init()
    }
    
    // MARK: Oauth授权相关
    let client_id = "1144660943"
    let redirect_uri = "http://www.baidu.com/"
    let oauthUrl = "https://api.weibo.com/oauth2/authorize"
    
    // 获得oauth授权的登录界面
    func oauthLoginUrl() -> NSURL {
        let urlString = oauthUrl + "?" + "client_id=" + client_id + "&" + "redirect_uri=" + redirect_uri
        
        return NSURL(string: urlString)!
    }

}
